The invention generally relates to computer programming and, more particularly, the invention relates to computer programming tools.
In object-oriented program languages, such as C++ and Smalltalk, a computer program typically consists of a number of objects. The objects, which contain both data and the functions that operate on the data, communicate with each other by calling one another""s functions. An object""s functions typically are the only way to access the object""s data. If, for example, a program wants to read an object""s data, the program calls the object""s function. In turn, the object""s function will read the data and return a value.
Objects are organized into classes. A class of objects is a specification for creating an object. In other words, an object is a single instance of a class of objects, with similar objects belonging to the same class. As a specification for an object, a class contains both data and the functions that operate on the data.
In the same manner, classes are organized into libraries. A library of classes of objects is a collection of classes logically related to each other to perform a particular task.
An object management system, such as Distributed Component Object Model (xe2x80x9cDCOMxe2x80x9d) and Common Object Request Broker Architecture (xe2x80x9cCORBAxe2x80x9d), allows classes created by different software vendors to interact with one another in the same address space, across address spaces, and across networks. However, in order to implement existing classes in an object management system, a programmer must write the necessary computer code. Typically, three computer files need to be written for each existing object-oriented program class-an interface file, a header file and a source file. The process can be complex and time-consuming. For example, in one project, in which 300 computer files with approximately 150,000 lines of computer code needed to be written, the programming team estimated the time needed to complete the project would be approximately 2 man years. Moreover, the potential for programming bugs is tremendous and, typically, these programming bugs can be difficult to locate.
In some object management systems, tools are available to help write the needed computer code. For example, Microsoft ""s Visual Studio contains an Active Template Library wizard to help with the creation of computer code for Microsoft""s DCOM. These tools, however, are more suited to-creating new objects in the object management system, referred to as component objects, rather than implementing existing object-oriented program classes as component objects in the object management system. However, even in using the tools, a programmer still needs to write a significant amount of implementation code. For the project described above, the programming team estimated it would still need approximately 15 man months to complete the project using the available tools.
In accordance with one aspect of the invention, a method and apparatus implements one or more existing object-oriented program classes as component objects in an object management system. Each class includes one or more member functions and each class is defined in a header file. First, the method and apparatus builds an information list. The information list includes a list of the classes and the member functions in each class. The method and apparatus then processes the information list. The processing includes parsing the header file for each class and reading a type file. The type file includes computer code for converting between an object-oriented type and an object management type. Last, the method and apparatus generates from the processed information list one or more output files for each component object, each component object implementing the member functions of one class.
In accordance with another aspect of the invention, a method and apparatus implements an existing object-oriented program class as a component object in an object management system, the class being defined in a header file. First, the method and apparatus reads the header file. The header file includes a list of member functions for the class. Next, the method and apparatus parses the header file. Then, the method and apparatus reads a type file. The type file includes computer code for converting between an object-oriented type and an object management type. The method and apparatus then generates a source file for the component object. The source file comprises computer code for use in implementing the listed member functions in the object management system based on the conversion code in the type file. Next, the method and apparatus generates an interface file for use in implementing the component object. When compiled, the interface file comprises one or more object management interfaces for the class. Last, the method and apparatus generates an object management header file for the component object.
In a further embodiment of both aspects of the invention, the output file (or files) are compiled into an object management server. In still further embodiments of both aspects of the invention, at least one class includes an excluded member function, the excluded member function being omitted in the one or more output files for the component object for the at least one class. In addition, at least one class includes an override member function, the override member function being pasted into the one or more output files for the component object for the at least one class. Further, at least one class includes an enums member function, the enums member function listed in an enums file, the enums file being read and parsed, and an enums interface file being generated. As an output file, the enums interface file is also compiled into the object management server.
In alternate embodiments of both aspects of the invention, the one or more existing object-oriented program classes are C++ classes. In addition, the object management system may be a Distributed Component Object Model.